
<table width='750'>
	<tr>
            <td align=center class=fr>STT</td>
            <td class=fr_2>Danh sách bạn</td>
        </tr>
        <?php
        $myID = $_SESSION['user_id'];
        $sql = "SELECT user_name AS 'FriendName', user_id AS 'FriendId'
        FROM ".$tb_prefix."friend
        INNER JOIN ".$tb_prefix."user ON ".$tb_prefix."friend.re_id = ".$tb_prefix."user.user_id
        WHERE u_id =$myID AND re_stt = 1
        UNION
        SELECT user_name AS 'FriendName', user_id AS 'FriendId'
        FROM ".$tb_prefix."friend
        INNER JOIN ".$tb_prefix."user ON ".$tb_prefix."friend.u_id = ".$tb_prefix."user.user_id
        WHERE re_id =$myID AND re_stt = 1
        ORDER BY `FriendName` asc";
            $query = $mysql->query($sql);
            if(!$mysql->num_rows($query)) {
            ?>
            <p>Bạn hiện chưa có quan hệ bạn bè</p>
            <?
            } else {
            while($row = $mysql->fetch_array($query)) {
                    $user_name	 	= $row['FriendName']; 
                    $user_id	 	= $row['FriendId'];
                    $user_URL	= url_link($user_id,$user_name,'User');
                    ?>
        <tr>
                <td align=center class=fr><?php echo $user_id; ?></td>
                <td class=fr_2><a href="<?php echo $user_URL; ?>"><font color=blue><?php echo $user_name; ?></font></a></td>
        </tr>
        <?php } 
            }?>
</table>
